

public class Customer {
    private String name;
    private String contact;
    private String deliveryAddress;
    private boolean active;
    private List<Order> orders;

    public Customer(String name, String contact, String deliveryAddress, boolean active) {
        this.name = name;
        this.contact = contact;
        this.deliveryAddress = deliveryAddress;
        this.active = active;
        this.orders = new ArrayList<>();
    }

    public void addOrder(Order order) {
        orders.add(order);
    }
}

public class Order {
    private Date createDate;
    private String status; // CREATE, PAID, SHIPPING, DELIVERED, CANCEL
    private List<OrderDetail> orderDetails;
    private List<Payment> payments;

    public Order(Date createDate, String status) {
        this.createDate = createDate;
        this.status = status;
        this.orderDetails = new ArrayList<>();
        this.payments = new ArrayList<>();
    }

    public void addOrderDetail(OrderDetail orderDetail) {
        orderDetails.add(orderDetail);
    }

    public void addPayment(Payment payment) {
        payments.add(payment);
    }
}

public class OrderDetail {
    private int quantity;
    private Product product;

    public OrderDetail(int quantity, Product product) {
        this.quantity = quantity;
        this.product = product;
    }

    public double calculateSubTotal() {
        return product.getPriceForQuantity() * quantity;
    }

    public double calculateWeight() {
        return product.getWeight() * quantity;
    }
}

public class Product {
    private String title;
    private double weight;
    private String description;

    public Product(String title, double weight, String description) {
        this.title = title;
        this.weight = weight;
        this.description = description;
    }

    public double getPriceForQuantity() {
        // 这里是价格的计算逻辑，例如根据数量折扣等
        return 10.0; // 示例价格
    }

    public double getWeight() {
        return weight;
    }
}

public abstract class Payment {
    protected double amount;

    public Payment(double amount) {
        this.amount = amount;
    }
}

public class Credit extends Payment {
    private String number;
    private String type;
    private Date expireDate;

    public Credit(double amount, String number, String type, Date expireDate) {
        super(amount);
        this.number = number;
        this.type = type;
        this.expireDate = expireDate;
    }
}

public class Cash extends Payment {
    private double cashTendered;

    public Cash(double amount, double cashTendered) {
        super(amount);
        this.cashTendered = cashTendered;
    }
}

public class WireTransfer extends Payment {
    private String bankID;
    private String bankName;

    public WireTransfer(double amount, String bankID, String bankName) {
        super(amount);
        this.bankID = bankID;
        this.bankName = bankName;
    }
}

public class AliPay extends Payment {
    private String number;

    public AliPay(double amount, String number) {
        super(amount);
        this.number = number;
    }
}

public class WeixinPay extends Payment {
    private String number;

    public WeixinPay(double amount, String number) {
        super(amount);
        this.number = number;
    }
}